import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import path from 'path'

/**
 * @type {import('vite').UserConfig}
 */

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    sourcemap: process.env.NODE_ENV === 'development',
  },
  plugins: [
    uni(),
    // 扫描指定目录中的svg图标资源文件
    createSvgIconsPlugin({
      iconDirs: [
        // 将相对路径转换为绝对路径
        path.resolve(process.cwd(), 'src/static/svg-icons'),
      ],
    }),
  ],
})
